import { IParam } from '@core';
import { LawPropagandizeUIServiceBase } from './law-propagandize-ui-service-base';

/**
 * 活动宣传UI服务
 *
 * @export
 * @class LawPropagandizeUIService
 * @extends LawPropagandizeUIServiceBase
 */
export class LawPropagandizeUIService extends LawPropagandizeUIServiceBase {

    /**
     * 基础UI服务实例
     * 
     * @private
     * @type { LawPropagandizeUIService }
     * @memberof LawPropagandizeUIService
     */
    private static basicUIServiceInstance: LawPropagandizeUIService;

    /**
     * UI服务存储Map对象
     *
     * @private
     * @type {Map<string, any>}
     * @memberof LawPropagandizeUIService
     */
    private static UIServiceMap: Map<string, any> = new Map();

    /**
     * Creates an instance of LawPropagandizeUIService.
     * @memberof LawPropagandizeUIService
     */
    constructor(opts?: IParam) {
        super(opts);
    }

    /**
     * 获取实例
     *
     * @static
     * @param 应用上下文
     * @return {*}  { LawPropagandizeUIService }
     * @memberof LawPropagandizeUIService
     */
    static getInstance(opts?: IParam): LawPropagandizeUIService {
         if (!this.basicUIServiceInstance) {
            this.basicUIServiceInstance = new LawPropagandizeUIService(opts);
        }
        if (!opts || !opts.srfdynainstid) {
            return this.basicUIServiceInstance;
        } else {
            if (!LawPropagandizeUIService.UIServiceMap.get(opts.srfdynainstid)) {
                LawPropagandizeUIService.UIServiceMap.set(opts.srfdynainstid, new LawPropagandizeUIService(opts));
            }
            return LawPropagandizeUIService.UIServiceMap.get(opts.srfdynainstid);
        }
    }
}
export default LawPropagandizeUIService;